package com.oa.android.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.oa.android.R;
import com.oa.android.entry.Buzou;
import com.oa.android.entry.Guoc;

import java.util.List;

/**
 * 步骤适配器
 * Created by zouqh on 2016/6/12.
 */
public class GuocAdapter extends BaseAdapter {
    private Context context;
    private List<Guoc> emils;


    public GuocAdapter(Context context, List<Guoc> list){
        this.context=context;
        this.emils=list;

    }
    @Override
    public int getCount() {
        return emils.size();
    }

    @Override
    public Object getItem(int position) {
        return emils.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHodler viewHodler;
        if (convertView==null){
            viewHodler=new ViewHodler();
            convertView= LayoutInflater.from(context).inflate(R.layout.guoc_item,null);
            viewHodler.jdxh=(TextView)convertView.findViewById(R.id.jdxh);
            viewHodler.jdmc=(TextView)convertView.findViewById(R.id.jdmc);
            viewHodler.jdwz=(TextView)convertView.findViewById(R.id.jdwz) ;
            viewHodler.spry=(TextView)convertView.findViewById(R.id.spry);
            viewHodler.spzs=(TextView)convertView.findViewById(R.id.spzs);
            viewHodler.spms=(TextView)convertView.findViewById(R.id.spms);
            convertView.setTag(viewHodler);
        }else {
            viewHodler= (ViewHodler) convertView.getTag();
        }
        Guoc emil=emils.get(position);


        viewHodler.jdxh.setText(emil.getID());
        viewHodler.jdmc.setText(emil.getYXBZNM()+"");
        viewHodler.jdwz.setText(emil.getCLBZNM());
        viewHodler.spry.setText(emil.getEMPNAME());
        viewHodler.spzs.setText("审批意见："+emil.getADVICE());
        viewHodler.spms.setText(emil.getSHTIME());
        return convertView;
    }

    class ViewHodler{
        TextView jdxh;
        TextView jdmc;
        TextView jdwz;
        TextView spry;
        TextView spzs;
        TextView spms;

    }
}
